<div class="layui-form" lay-filter="layuiadmin-form-type" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">类型名</label>
        <div class="layui-input-inline">
            <input type="text" name="type_name" lay-verify="required" placeholder="请输入类型名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">工分</label>
        <div class="layui-input-inline">
            <input type="number" name="type_count" lay-verify="required" placeholder="请输入工分" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" lay-filter="type_flag">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <input type="radio" name="type_flag" value="0" title="启用" checked>
            <input type="radio" name="type_flag" value="1" title="禁用">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年份</label>
        <div class="layui-input-inline">
            <input type="text" name="type_years" lay-verify="required" placeholder="请输入年份" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="LAY-type-add" value="确认" class="layui-btn">
        </div>
    </div>
</div>


<script>
    layui.use(['admin', 'form'], function(){
        var $ = layui.$
            ,form = layui.form;

    });
    /* layui.data.sendParams = function(params){
        console.log(params);    //得到传递过来的参数
    }); */
    layui.use([ 'form', 'layer' ], function() {
        $ = layui.$;
        var form = layui.form, layer = layui.layer;
        //加载外键1
        $.ajax({
            url : '/getTypeServlet',
            dataType : 'json', //服务器返回json格式数据
            type : 'post', //HTTP请求类型
            timeout : 10000, //超时时间设置为10秒；
            success : function(data) {
                $.each(data.data, function(index, value) {
                    $('#pdnames').append(
                        new Option(value.typeName, value.typeId));// 下拉菜单里添加元素
                });
                form.render("select");
            }
        });
        /* //加载外键2
        $.ajax({
            url : '/ChinapartyProject/getDeptsServlet',
            dataType : 'json', //服务器返回json格式数据
            type : 'post', //HTTP请求类型
            timeout : 10000, //超时时间设置为10秒；
            success : function(data) {
                $.each(data.data, function(index, value) {
                    $('#pdnames').append(
                            new Option(value.departmentName, value.departmentid));// 下拉菜单里添加元素
                });
                form.render("select");
            }
        }); */
    });
</script>
//